Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add feat/jsdoc-require-returns-type eslint rule #115

Merged

Conversation

Pathan-Amaankhan
Copy link
Member

@Pathan-Amaankhan Pathan-Amaankhan commented Mar 3, 2025

What

Related Issue(s):

Testing Instructions

  • Run npm install && npm run lint.

Additional Info

  • As this PR fixes the codebase, we won't be getting any eslint errors.

Checklist

  • I have read the Contribution Guidelines.
  • My code is tested to the best of my abilities.
  • My code passes all lints (ESLint, tsc, prettier etc.).
  • My code has detailed inline documentation.
  • I have added unit tests to verify the code works as intended.
  • I have updated the project documentation as needed.
  • I have added a changeset for this PR using npm run changeset.

Copy link

changeset-bot bot commented Mar 3, 2025

🦋 Changeset detected

Latest commit: 5d17c47

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@snapwp/e2e-tests Patch
@snapwp/blocks Patch
@snapwp/query Patch
@snapwp/types Patch
@snapwp/core Patch
@snapwp/next Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@Pathan-Amaankhan Pathan-Amaankhan marked this pull request as ready for review March 3, 2025 16:49
@Pathan-Amaankhan Pathan-Amaankhan self-assigned this Mar 3, 2025
@justlevine justlevine requested a review from ayushnirwal March 3, 2025 20:14
justlevine
justlevine previously approved these changes Mar 3, 2025
Copy link
Collaborator

@justlevine justlevine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm approving based on the CI passing.

I still think it's counterintuitive to be doing ESLint types before we fix/enforce our TS types 🤷

Pinging @ayushnirwal in case he has something to add.

@justlevine justlevine changed the title feat: Add feat/jsdoc-require-returns-type eslint rule chore: Add feat/jsdoc-require-returns-type eslint rule Mar 3, 2025
@justlevine
Copy link
Collaborator

(its a chore: because no production code has changed ).

@justlevine
Copy link
Collaborator

(better to enforce return types vs TS - on hold)

Copy link
Collaborator

@ayushnirwal ayushnirwal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use require-returns to enforce descriptions. (as a warning)
Use explicit-function-return-type to enforce return types in TS (as an error)

@Pathan-Amaankhan
Copy link
Member Author

Pathan-Amaankhan commented Mar 11, 2025

Hi @ayushnirwal,
Have added @typescript-eslint/explicit-function-return-type eslint rule & fixed all the eslint issues.

cc: @justlevine

Copy link
Collaborator

@justlevine justlevine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for me to review this again. Once @ayushnirwal approves this and a changeset is added, lmk and I'll merge.

Copy link
Collaborator

@ayushnirwal ayushnirwal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is mergable after this and merge conflicts are resolved. Also, changeset too.

Copy link
Collaborator

@justlevine justlevine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, I switched the return types from the problematic JSX.Element to ReactNode.

Also explicitly importing types ... from 'React'; since it's better to be explicit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants